﻿using System;
using System.Collections.Generic;
using System.Text;
using Iesi.Collections.Generic;
using System.Runtime.Serialization;
using System.ComponentModel;

namespace NLBS.Entity
{
    public class BaseEntity:INotifyPropertyChanged
    {
        #region INotifyPropertyChanged Members
        private PropertyChangedEventHandler _propertyChangedEvent;
        public event PropertyChangedEventHandler PropertyChanged
        {
            add
            {
                _propertyChangedEvent += value;
            }
            remove
            {
                _propertyChangedEvent -= value;
            }
        }

        protected void RaisePropertyChanged(string propertyName)
        {
            if (_propertyChangedEvent != null)
            {
                _propertyChangedEvent(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
    }


    [DataContract]
    public class Category 
    {

        public Category() { }

        private int _categoryID;

        /// <summary>
        /// 分类编号
        /// </summary>
        [DataMember]
        public virtual int CategoryID
        {
            get { return _categoryID; }
            set { _categoryID = value; }
        }

        private string _name;
        /// <summary>
        /// 分类名
        /// </summary>
        [DataMember]
        public virtual string Name
        {
            get { return _name; }
            set { _name = value;  }
        }
        //RaisePropertyChanged("Name");
        private int _order;
        /// <summary>
        /// 排序编号
        /// </summary>
        [DataMember]
        public virtual int Order
        {
            get { return _order; }
            set { _order = value; }
        }

        private int _articleCount;
        /// <summary>
        /// 分类下日志数
        /// </summary>
        [DataMember]
        public virtual int ArticleCount
        {
            get { return _articleCount; }
            set { _articleCount = value; }
        }

        private bool _hidden;
        /// <summary>
        /// 是否隐藏
        /// </summary>
        [DataMember]
        public virtual bool Hidden
        {
            get { return _hidden; }
            set { _hidden = value; }
        }

        private bool _locked;
        /// <summary>
        /// 是否锁定
        /// </summary>
        [DataMember]
        public virtual bool Locked
        {
            get { return _locked; }
            set { _locked = value; }
        }

        [DataMember]
        public virtual IList<Article> Articles { get; set; }
        [DataMember]
        public virtual ISet<Article> SmallArticles { get; set; }
    }

}
